// stores/user.ts
import { defineStore } from 'pinia'
interface UserInfo  {
    avatar: string
  username: string
}

export const useUserStore = defineStore('user', {
  state: () => ({
    token: '',
    userInfo: {} as UserInfo
  }),
  actions: {
    login(){

    },
    logout(){

    },

    setToken(token: string) {
      this.token = token
    },
    setUserInfo(userInfo: object) {
      this.userInfo = userInfo as UserInfo
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'user',
        storage: localStorage
      }
    ]
  }
})